perm filename CKPNT[E,ALS] blob sn#265093 filedate 1977-02-21 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00002 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	TITLE CKPNT checkpoints a program
C00004 ENDMK
C⊗;
TITLE CKPNT checkpoints a program
; This routine can be used by a sail program to save itself.
; The program must be run without upper segment, and the state
; of the i/o channels is not (of course) preserved.


INTERNAL CKPNT
JOBSA ←← 120
JOBREL ←← 44

CKPNT:
	setz	2,
	GETNAM	2,		;get job name
	movem	2,dat+1		;use it for save file
	move	2,jobsa		;starting address
	hrri	3,tmpsa		;restart addr.
	hrl	3,jobrel
	movem	3,jobsa		;to jobsa
	move	1,[2,,acsave]	;save ac's
	blt	1,acsave+16
	move	1,[dat,,dat]	;save and restore
	SWAP	1,
tmpsa:	move	1,[acsave,,2]	;come back here and restore ac's
	blt	1,17
	movem	2,jobsa		;restore jobsa
	popj	17,		;return to caller
	
DAT:	sixbit /DSK/
	sixbit /      /		;jobname gets put here
	sixbit /DMP/
	0
	0
	0
	
acsave:	block 17		;ac's get saved here

END